package com.matt.sooncleaner.notification

import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.matt.sooncleaner.arch.ArchActivity
import com.matt.sooncleaner.arch.dp
import com.matt.sooncleaner.arch.widget.SpaceItemDecoration
import com.matt.sooncleaner.databinding.ActivityNotificationManagerBinding
import kotlinx.coroutines.launch

/**
 *
 * Created by xiexiang10 on 2024/6/17.
 **/
class NotificationManagerActivity: ArchActivity<ActivityNotificationManagerBinding>() {
    private val mAdapter = NotificationAppAdapter()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.recyclerView.layoutManager = LinearLayoutManager(this)
        binding.recyclerView.adapter = mAdapter
        binding.recyclerView.addItemDecoration(SpaceItemDecoration(13.dp))
        lifecycleScope.launch {
            mAdapter.submitList(NotificationHelper.getInstallAppList())
            binding.loadingProgress.hide()
        }
        binding.toolbar.setNavigationOnClickListener { finish() }
        binding.doneBtn.setOnClickListener { finish() }
        binding.loadingProgress.show()
    }
}